<template lang="pug">
van-nav-bar(:title="title" left-arrow :border="false" z-index="1000" :placeholder="true" :fixed="true" @click-left="goIndex")

</template>

<script>
import { useRouter, useRoute } from "vue-router";
export default {
  name: "CommonNav",
  props: {
    title: String,
  },
  setup() {
    const router = useRouter();
    // const route = useRoute();
    // console.log("route:", route);
    // console.log("router:", router);
    const goIndex = () => {
      if (window.history.length <= 1) {
        router.push({ path: "/" });
      } else {
        router.go(-1);
      }
    };
    return {
      goIndex,
    };
  },
};
</script>

<style>
:root {
  --van-nav-bar-background-color: #1d1d27 !important;
  --van-nav-bar-icon-color: #fff !important;
  --van-nav-bar-title-text-color: #fff !important;
  --van-nav-bar-height: 44px !important;
  --van-nav-bar-arrow-size: 22px !important;
}
</style>
